package enumerated.tij;

import static util.Print.*;

import java.lang.reflect.Method;

enum Search {
	HITHER, YON
}

public class UpcastEnum {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Search[] vals = Search.values();
		Enum e = Search.HITHER; // Upcast
		
		print("e.getClass().getSuperclass(): "  + e.getClass().getSuperclass());
		print("e.getClass().getMethods(): ");
		for(Method m : e.getClass().getMethods())
			printnb(m.getName() + " ");
		print("");
		// But you can find e.vaules() still exists by reflection
		// And finally, getEnumConstants() call e.values() to provide EnumConstants
		
		// e.values(); // No values() in Enum
		for (Enum en : e.getClass().getEnumConstants())
			System.out.println(en);
	}
}
/* Outputs:
e.getClass().getSuperclass(): class java.lang.Enum
e.getClass().getMethods(): 
valueOf values hashCode compareTo compareTo name equals toString valueOf getDeclaringClass ordinal getClass wait wait wait notify notifyAll 
HITHER
YON
 */
